<?php

if($_REQUEST['type'] == 'gamer')
{
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $_REQUEST['name'] . ".gamer.ru/posts");
	curl_setopt($curl, CURLOPT_HEADER, true);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_NOBODY, true);
	$buffer = curl_exec($curl);
	curl_close($curl);

	preg_match("#HTTP/1.1 200 OK#i", $buffer, $matches);
	if(count($matches))
	{
		echo "1";
	}
	else
	{
		echo "0";
	}
}
else if($_REQUEST['type'] == 'blog')
{
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, "www.gamer.ru/games/" . $_REQUEST['name'] . "/posts");
	curl_setopt($curl, CURLOPT_HEADER, true);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_NOBODY, true);
	$buffer = curl_exec($curl);
	curl_close($curl);
	
	preg_match("#HTTP/1.1 200 OK#i", $buffer, $matches);
	if(count($matches))
	{
		echo "1";
	}
	else
	{
		echo "0";
	}
}

?>